﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Base64Decoder
{
    class Base64Decoder
    {
        public static void EncodeToBase64(string inputFilePath, string outputFilePath)
        {
            StreamReader reader = new StreamReader(inputFilePath);
            using (reader)
            {
                FileStream writingStream = File.OpenWrite(outputFilePath);
                using (writingStream)
                {
                    BinaryWriter writer = new BinaryWriter(writingStream);
                    using (writer)
                    {
                        string line = reader.ReadLine();
                        while (line != null)
                        {
                            byte[] encodedDataAsBytes = System.Convert.FromBase64String(line);
                            writer.Write(encodedDataAsBytes);
                            line = reader.ReadLine();
                        }
                    }
                }
            }
        }
    }
}
